<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="renderer" content="webkit">
	<title>推广明细</title>
	<meta name="keywords" content="">
	<meta name="description" content="">
	<!--[if lt IE 9]>
	<meta http-equiv="refresh" content="0;ie.html" />
	<![endif]-->
	<link rel="shortcut icon" href="favicon.ico">
	<link href="__STATIC__/css/bootstrap.min.css" rel="stylesheet">
	<link href="__STATIC__/css/font-awesome.min.css" rel="stylesheet">
	<link href="__STATIC__/css/plugins/iCheck/custom.css" rel="stylesheet">
	<link href="__STATIC__/css/animate.css" rel="stylesheet">
	<link href="__STATIC__/css/style.css" rel="stylesheet">
</head>

<body class="fixed-sidebar full-height-layout gray-bg">
<div id="wrapper">
	<!--左侧导航开始-->
	<include file="Public/left" title="left" />
	<!--左侧导航结束-->
	<!--右侧部分开始-->
	<div id="page-wrapper" class="gray-bg dashbard-1" style="height: auto;">
		<include file="Public/top" title="top" />
		<div class="row J_mainContent" id="content-main">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<div class="row">
							<div class="col-md-8">
								<h3>推广明细</h3>
							</div>
							<div class="col-sm-4">
								<form action="" method="post" id="adminForm" name="adminForm">
									<div class="form-group input-group">
										<input type="text" class="form-control" name="key" placeholder="输入用户账号/应用昵称搜索" value="{$key}">
										<span class="input-group-btn">

                        <input class="btn btn-default" type="submit" id="selecting" value="提交">
                    </span>
									</div>
								</form>
							</div>
						</div>
						<div class="table-responsive">
							<table class="table table-striped">
								<thead>
								<tr>
									<th>ID</th>
									<th>发布人</th>
									<th>应用昵称</th>
									<th>推广次数</th>
									<th>时间</th>
									<th>操作</th>
								</tr>
								</thead>
								<tbody>

								<foreach name="model" item="v" key="k">
										<tr>
											<!--id-->
											<td><input type="checkbox" class="i-checks" value="{$v.id}">{$v.id}</td>
											<!--发布人-->
											<td>{$v.fid|getName}</td>
										
											<!--昵称-->
											<td>{$v.nickname}</td>
											<!--下载次数-->
											<td>{$v.ipnum}</td>
											<!--时间-->
											<td>{$v.create_time|date="Y/m/d",###}</td>

											<td>
												<a href="{:U('list/iplist',array('id'=>$v['id']))}">查看明细</a>
												<a href="{:U('list/ipdelete',array('id'=>$v['id']))}" style="color:red;" onclick="javascript:return del();">清空</a>
											</td>
										</tr>

								</foreach>
								</tbody>
							</table>
							<form action="{:U('list/ipdelete')}" method="post" name="form3" id="form3">
								<div>
										<span>
											<input type="checkbox" class="i-checks" id="quanxuan">全选
											<button type="submit" id="huoqu" class="btn btn-primary" >清空</button>
										</span>
								</div>
							</form>
							<div class="Item hr" style="float:right;">
								<div class="current" id="pageBar">{$page}</div>
							</div>
							<div>
								共有 {$lengths} 条数据
							</div>
						</div>
					</div>

				</div>
			</div>
		</div>
	</div>
</div>
<!--右侧部分结束-->
</div>

<!-- 全局js -->
<script src="__STATIC__/js/jquery.min.js"></script>
<script src="__STATIC__/js/bootstrap.min.js"></script>
<script src="__STATIC__/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="__STATIC__/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="__STATIC__/js/plugins/layer/layer.min.js"></script>
<!-- 自定义js -->
<script src="__STATIC__/js/hAdmin.js"></script>
<script src="__STATIC__/js/content.js"></script>
<!-- 第三方插件 -->
<script src="__STATIC__/js/plugins/pace/pace.min.js"></script>
<!-- iCheck -->
<script src="__STATIC__/js/plugins/iCheck/icheck.min.js"></script>
</body>

</html>
<script>
var s = "" ;
var str ="";
$(document).ready(function() {
    $('.i-checks').iCheck({
        checkboxClass: 'icheckbox_square-green',
        radioClass: 'iradio_square-green',
    });
    var checkAll = $('#quanxuan'); //全选的input
    var checkboxs = $('.i-checks'); //所有单选的input

    checkAll.on('ifChecked ifUnchecked', function(event) {
        if(event.type == 'ifChecked') {
            checkboxs.iCheck('check');

            $("input[class='i-checks']:checked").each(function () {
                if(true == $(this).is(':checked')){
                    str+=$(this).val()+",";
                }
                if(str.substr(str.length-1)== ','){
                    s = str.substr(0,str.length-1);

                }

            });


        } else {
            checkboxs.iCheck('uncheck');
            s = "";
        }
    });
    checkboxs.on('ifChanged', function(event){
        var str = "";
        if(checkboxs.filter(':checked').length == checkboxs.length) {
            checkAll.prop('checked', 'checked');
        } else {
            checkAll.removeProp('checked');
            $("input[class='i-checks']:checked").each(function () {
                if(true == $(this).is(':checked')){
                    str+=$(this).val()+",";
                }
                if(str.substr(str.length-1)== ','){
                    s = str.substr(0,str.length-1);
                }
            });
        }
        checkAll.iCheck('update');
    });

});
function del() {
	var msg = "您真的确定要清空吗？\n\n清空后将不能恢复!";
	if (confirm(msg)==true){
	return true;
	}else{
	return false;
	}
}
//获取选中项
$('#huoqu').click(function () {

    var input = document.createElement('input');  //创建input节点
    input.setAttribute('type', 'hidden');  //定义类型是文本输入
    input.id = "id";
    input.name = "id";
    input.value = s;
    document.getElementById('form3').appendChild(input ); //添加到form中显示

    var form = document.getElementById("form3");
    form.submit();//form表单提交
});

function submitForm(){
//获取form表单对象
    var form = document.getElementById("form2");

    form.submit();//form表单提交
}
function submitForms(){
//获取form表单对象
    var form = document.getElementById("form4");

    form.submit();//form表单提交
}
$(function(){
    // 分页（修改链接方法）
    $('#pageBar a').click(function(){
        var tmpHref = $(this).attr('href');
        $("#adminForm").attr("action", tmpHref);
        $("#adminForm").submit();

        return false;
    });
});
$(function(){
    //查询
    $("#selecting").click(function(){

        $("#form").attr("action", "__URL__/index/p/");
        $("#form").submit();
    });
})
</script>
